package com.sec.android.app.myfiles.shadow.sem;

import android.content.Context;
import android.os.Bundle;

import com.samsung.android.knox.SemPersonaManager;

import org.powermock.api.mockito.PowerMockito;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

import static org.powermock.api.mockito.PowerMockito.when;

/**
 * Created by jaebae on 2016-07-04.
 */
@Implements(SemPersonaManager.class)
public class ShadowSemPersonaManager {
    public static boolean sRetNull = false;
    public static boolean sRetException = false;

    public static void init() {
        sRetNull = false;
        sRetException = false;
    }

    @Implementation
    public static Bundle getKnoxInfoForApp(Context ctx) {
        Bundle ret = null;
        if (!sRetNull) {
            ret = PowerMockito.mock(Bundle.class);
            when(ret.getString("isBlockExternalSD")).thenReturn("false");
        }

        if (sRetException) {
            throw new NoClassDefFoundError("NoClassDefFoundError");
        }
        return ret;
    }
}
